// -----------------------------------------------
// Author:     code34 nicolas_boiteux@yahoo.fr
// Edited by:  Neumatic
// Warcontext: Call halo jump 
// -----------------------------------------------

private ["_position","_positionplayer"];

_position = getPosATL player;

wcgarbage = [localize "STR_WC_MENUHALOJUMP", localize "STR_WC_MESSAGECLICKHALOJUMP", localize "STR_WC_MESSAGEHALOJUMPINFORMATION", 10] spawn WC_fnc_playerhint;

openMap [true, false];

wchalojumppos = [];

onMapSingleClick "titleText ['','BLACK IN', 10]; wchalojumppos = _pos; onMapSingleClick''; openMap [false, false];";

while {visibleMap} do {
	sleep 0.5;
};

if (count wchalojumppos == 0) then {
	onMapSingleClick "";
	wcgarbage = [localize "STR_WC_MENUHALOJUMP", localize "STR_WC_MESSAGEHALOJUMPNEWONE", localize "STR_WC_MESSAGECANCELHALOJUMPINFORMATION", 10] spawn WC_fnc_playerhint;
} else {
	_position = [(wchalojumppos select 0), (wchalojumppos select 1), 250];
	_positionplayer = getPosATL player;
	wcgarbage = [_position, _positionplayer] spawn {
		private ["_position","_para"];
		_position       = _this select 0;
		_positionplayer = _this select 1;
		{	
			if ((!isPlayer _x) and {(_x distance _positionplayer < 50)}) then {
				_para = createVehicle ["ParachuteC", _position, [], 0, "NONE"];
				_para setPos _position;
				_para setDir (getDir player);
				_para setVelocity [random 30, random 30, 10];
				_x moveInDriver _para;
				_para lock false;
				sleep 1;
			};
		} foreach (units (group player));
	};

	player setPos [(wchalojumppos select 0), (wchalojumppos select 1), 1000];
	player switchMove "HaloFreeFall_non";
	wcgarbage = [player, 1000] spawn BIS_fnc_halo;
	wcgarbage = [player] spawn WC_fnc_altimeter;
};